#!/usr/bin/env python

import os
import sys
import signal
import SimpleXMLRPCServer

import titlist

# a handler to handle sigterm
def terminate(signum, frame):
    sys.exit()

signal.signal(signal.SIGTERM, terminate)

myTitlist = titlist.Titlist()
myTitlist.start()
myTitlist.update(('Titlist v0.1', 'Please Stand By'))

# Create the XMLRPC Server
server = SimpleXMLRPCServer.SimpleXMLRPCServer(('127.0.0.1', 40001))

# Register the Titlist with the xmlrpc server
server.register_instance(myTitlist)

#Go into the main listener loop
server.serve_forever()